package main
import (
	"fmt";
	"sort"
)

func main(){
	map1 := make(map[int]int,10)
	map1[0]=10
	map1[1]=11
	map1[5]=12
	map1[9]=13
	map1[4]=14
	map1[8]=15
	// fmt.Println(map1)
	// 如果想对map进行排序
	// 先定义 切片放着key
	// 遍历切片 然后按照key来输出map的值
	var keys []int
	for k ,_ :=range map1{
		fmt.Println(k)
	   keys=append(keys,k)
	}
	sort.Ints(keys)
	fmt.Println(keys)


	for _,v:=range keys{
		fmt.Println(map1[v])
	}

	type Stu struct {
		Name string
		Age int
		Address string
	}
	var studens =make(map[string]Stu,2)
	sdu1:=Stu{"tom",18,"北京市"}
	sdu2 :=Stu{"刘曜宇",20,"林州市"}
	studens["no1"]=sdu1
	studens["no2"]=sdu2
	fmt.Println(studens)


	for k,v:=range studens{
		fmt.Printf("编号是%v\n",k)
		fmt.Printf("名城市%v\n",v.Name)
		fmt.Printf("年龄市%v\n",v.Age)
		fmt.Printf("地址市%v\n",v.Address)
		fmt.Println()
	}
}